﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BeeTest.Samples
{
    [TestClass]
    public class StaticInitializationTests : BehaviorTestBase
    {
        public class Foo
        {
            public static int Init01Called      = 0;
            public static int Init02Called      = 0;
            public static int OperationCalled   = 0;

            public static void Init01() { Init01Called++; }
            public static void Init02() { Init02Called++; }

            public static void Operation() { OperationCalled++; }
        }

        [TestMethod]
        public void WithoutAnyState()
        {
            this.Given(Foo.Init01)
                .And.Given(Foo.Init02)
                .And.Given(Foo.Init02)
                .When(Foo.Operation)
                .Then(AssertWithoutAnyState);
        }

        private void AssertWithoutAnyState()
        {
            Assert.AreEqual(1, Foo.Init01Called);
            Assert.AreEqual(2, Foo.Init02Called);
            Assert.AreEqual(1, Foo.OperationCalled);
        }
    }
}
